test: add regression tests for passport number normalization (#253) - #299
Open
faizkhairi wants to merge 1 commit into
Open
test: add regression tests for passport number normalization (#253)#299faizkhairi wants to merge 1 commit into
faizkhairi wants to merge 1 commit into
Conversation
Add test_passport_normalization() to verify that passport numbers (e.g., EL9568719, A20964577) are expanded digit-by-digit, not as cardinal numbers (e.g., "nine million five hundred..."). Regression test for malaysia-ai#253. The fix was implemented in commit 0c98809 but had no test coverage to prevent future regressions.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Adds test coverage for passport number normalization (issue #253). The fix was implemented in commit 0c98809 but had no test cases to prevent future regressions.
What's tested
Verifies that passport numbers like
EL9568719andA20964577are expanded digit-by-digit (e.g., "E L nine five six eight...") rather than as cardinal numbers (e.g., "nine million five hundred...").The test asserts that normalized output does not contain cardinal expansion words ("million", "thousand", "hundred", "juta", "ribu", "ratus").
Why this matters
The normalizer pipeline has ~30 pattern checks in sequence. A regression in pattern ordering or regex changes could cause passport numbers to fall through to the cardinal number handler (line 1209 in rules.py). This test catches that.
Files changed
tests/tests/test_normalization.pytest_passport_normalization()+ importmalaya.normalizer.rulesTest plan
pytest tests/tests/test_normalization.py::test_passport_normalization -v